﻿using System.Configuration;

namespace netaddICTs.Umb.ProtectedMedia.Business.Configuration {

    public class ProtectedMedia : ConfigurationSection {

        internal const string DownloadSHA1PropertyName = "downloadSHA1";

        [ConfigurationProperty(DownloadSHA1PropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false, DefaultValue = "Key1")]
        public string SHA1{
            get { return (string)base[DownloadSHA1PropertyName]; }
            set { base[DownloadSHA1PropertyName] = value; }
        }

        internal const string InternalDownloadSHA1PropertyName = "internalDownloadSHA1";

        [ConfigurationProperty(InternalDownloadSHA1PropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false, DefaultValue = "Key2")]
        public string InternalDownloadSHA1{
            get { return (string) base[InternalDownloadSHA1PropertyName]; }
            set { base[InternalDownloadSHA1PropertyName] = value; }
        }

        internal const string StoragePropertyName = "storage";

        [ConfigurationProperty(StoragePropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
        public Storage Storage{
            get { return (Storage) base[StoragePropertyName]; }
            set { base[StoragePropertyName] = value; }
        }

        internal const string NodesPropertyName = "nodes";

        [ConfigurationProperty(NodesPropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
        public Nodes Nodes{
            get { return (Nodes) base[NodesPropertyName]; }
            set { base[NodesPropertyName] = value; }
        }

        internal const string AliasesPropertyName = "aliases";

        [ConfigurationProperty(AliasesPropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
        public Aliases Aliases{
            get { return (Aliases) base[AliasesPropertyName]; }
            set { base[AliasesPropertyName] = value; }
        }

        internal const string ProtectedMediaConfigurationSectionName = "protectedMedia";

        public static ProtectedMedia Instance{
            get { return ConfigurationManager.GetSection(ProtectedMediaConfigurationSectionName) as ProtectedMedia; }
        }
    }
}